//
//  ShoppingModel.m
//  wtshoppingcite
//
//  Created by TW on 14-10-16.
//  Copyright (c) 2014年 TW. All rights reserved.

#import "ShoppingModel.h"

@implementation ShoppingModel

- (id)initWithNearInfo:(NSDictionary *)info type:(ShopTableDataStyle)type{
    if(self = [super init]){
        id bid = [info objectForKey:@"productId"];
        self.sid = ObjToString(bid);
        
        id title = [info objectForKey:@"productName"];
        self.title = ObjToString(title);
        
        id oPrice = [info objectForKey:@"originalPrice"];
        self.oPrice = ObjToString(oPrice);
        
        
        switch (type) {
            case ShopTableDataStyleEShop:
            {
                id nPrice = [info objectForKey:@"grouponPrice"];
                self.nPrice = ObjToString(nPrice);
            }
                break;
            case ShopTableDataStyleBusiness:
            {
                id nPrice = [info objectForKey:@"salePrice"];
                self.nPrice = ObjToString(nPrice);
            }
                break;
            default:
            {
                id nPrice = [info objectForKey:@"salePrice"];
                self.nPrice = ObjToString(nPrice);
            }
                break;
        }


        
        id sNum = [info objectForKey:@"count"];
        self.sNum = ObjToString(sNum);

        id sPic = [info objectForKey:@"mainImgPath"];
        self.sPic = ObjToString(sPic);

        id favor = [info objectForKey:@"productUnit"];
        self.favor = ObjToString(favor);
        
        id subTitle = [info objectForKey:@"descp"];
        self.subTitle = ObjToString(subTitle);
        
        id saledCount = [info objectForKey:@"saledCount"];
        self.saledCount = ObjToString(saledCount);

    }
    return self;
}

@end
